import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
import { getTeacherList } from './ClassManagement.api';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '序号',
    align: 'center',
    dataIndex: 'Serial Number',
    width: 100,
  },
  {
    title: '实验课班级名称',
    align: 'center',
    dataIndex: 'className',
    width: 240,
  },
  {
    title: '班级人数',
    align: 'center',
    dataIndex: 'classNumber',
    width: 100,
  },
  {
    title: '添加时间',
    align: 'center',
    dataIndex: 'addTime',
    width: 200,
  },
  {
    title: '班级管理员',
    align: 'center',
    dataIndex: 'classManager',
    width: 200,
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '实验课班级',
    field: 'className',
    component: 'JInput',
    colProps: { span: 6 },
  },
  {
    label: '管理员',
    field: 'classManager',
    component: 'JInput',
    colProps: { span: 6 },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '班级名称',
    field: 'className',
    component: 'Input',
    required: true,
  },
  {
    label: '班级管理员',
    field: 'classManager',
   
    required: true,
     component: 'ApiSelect',
       componentProps: {
        //  mode: 'multiple',
         api: getTeacherList,
         labelField: 'managerName',//返回接口数据中的文字
         valueField: 'managerId',
         immediate: false,
       },
  },

  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  majorId: { title: '专业主键', order: 0, view: 'text', type: 'string' },
  className: { title: '班级名称', order: 1, view: 'text', type: 'string' },
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
